<?php

/**
 * 2020/9/30
 * Created by breeze
 * User: breeze
 */
namespace app\api\controller;


use app\api\validate\User;
use app\BaseController;
use app\api\business\SmsBus;
class Sms extends BaseController
{
    public function code() :object{
        $phone = $this->request->param("phone_number");
        $date = [
            'phone_number' => $phone
        ];
        $validate = new User();
        if(!$validate->scene('send_code')->check($date)){
            return show(config("status.success"),$validate->getError());
        }
        $smsBus = new SmsBus();
        if($smsBus->sendMessage($phone,6,"ali")){
            return show(config("status.success"),'发送验证码成功');
        }else{
            return show(config("status.error"),'发送验证码失败');
        }
//        return show(config("status.success"),$smsBus->sendMessage($phone));

    }
}